<div id="dyn_fieldset_{$content.fieldname}_{$obj.obj_id}">
	<div class="divFormFieldLabel" style="position:relative;">{$content.label|htmlentitiesutf8}</div>
	<div class="divFormFieldInput" style="position:relative;">
		<div id="change_dyn_template_{$content.fieldname}_{$obj.obj_id}">
			<select size="1" name="add_fieldsset_{$content.fieldname}_{$obj.obj_id}">
				<option value="--">Vorlage wählen</option>
			</select> 
			<input type="button" style="width:100px;" value="verwenden"  onclick="ContentEditorDynamicFieldAdd('add_dyn_field_{$content.fieldname}_{$obj.obj_id}');"/>
			<a href="javascript:void(0);" onclick="$('#new_dyn_template_{$content.fieldname}_{$obj.obj_id}').toggle();">neue Vorlage erstellen</a>
		</div>
		<br /><br />
	</div>
	<br style="clear:both;" />
	<div id="new_dyn_template_{$content.fieldname}_{$obj.obj_id}" style="">
		<h2>neue Vorlage erstellen</h2>
		<div style="border:1px dashed #CCC;padding:4px;">
			Name: <input id="new_dyn_template_name_{$content.fieldname}_{$obj.obj_id}" type="text" name="template_name" />
			<input type="button" value="Vorlage erstellen" onclick="{strip}{literal}
				xajax.request(
				{
					ccdsfun:'ContentEditorDynamicTemplateNew',
					ccdsclass:'ccdsContentEditor'
				},
				{
					parameters:[{
						{/literal}
						obj_id:'{$obj.obj_id}',
						project_id:'{$obj.obj_key_project_id}',
						fieldname:'{$content.fieldname}',
						name:xajax.$('new_dyn_template_name_{$content.fieldname}_{$obj.obj_id}').value
						{literal}
					}]
				}
				);
			{/literal}{/strip}"/>
		</div>
	</div>
	
	<h2>Aktuelle Vorlage: </h2>
	<div style="border:1px dashed #CCC;padding:4px;">
	
		{if is_array($content.fields)} 
		
			{foreach from=$content.fields key="key" item="field"}
					{if file_exists("`$CMS_TPL_DIR`forms/`$field.formtype`.tpl")}
						{include file="`$CMS_TPL_DIR`forms/`$field.formtype`.tpl" content=$field obj=$obj prefix="`$prefix`[`$content.fieldname`]"}
						<input type="hidden" name="obj[{$obj.obj_id}][{$content.fieldname}][{$field.label}][formtype]" value="{$field.formtype}" />
						<input type="hidden" name="obj[{$obj.obj_id}][{$content.fieldname}][{$field.label}][label]" value="{$field.label}" />
					{else}
						<strong>MISSING</strong> {$field.type}<br />
					{/if}
			{/foreach}
		{else}
		Keine Felder vorhanden. Bitte wählen Sie eine Vorlage!
		{/if}
		<div id="dyn_area_{$content.fieldname}_{$obj.obj_id}"></div>
	</div>
	
	<h2> Vorlage erweitern</h2>
	<div style="border:1px dashed #CCC;padding:4px;">
		<div class="divFormFieldLabel" style="position:relative;">{$content.label|htmlentitiesutf8}</div>
		<div class="divFormFieldInput" style="position:relative;">
	
			<div id="add_dyn_field_{$content.fieldname}_{$obj.obj_id}">
				Bezeichnung: <input type="text" name="fieldlabel"><br />
				Fieldtype: 
				<select size="1" name="fieldtype">
					<option value="text">einzeiliges Textfeld</option>
					<option value="plaintext">mehrzeiliges Textfeld</option>
					<option value="html">WYSIWIG Editor</option>
					<option value="image">Bild</option>
					<option value="gallery">Bildergalerie</option>
					<option value="file">Datei</option>
					<option value="multiselect">Mehrfachauswahl</option>
					<option value="geshi">GeSHi</option>
				</select>
				<input type="button" value="hinzufügen" onclick="{strip}{literal}
					xajax.request(
						{
							ccdsclass:'ccdsContentEditor',
							ccdsfun:'ContentEditorDynamicFieldAdd'
						},
						{
							parameters:[{{/literal}
								field : xajax.getFormValues('add_dyn_field_{$content.fieldname}_{$obj.obj_id}'),
								obj_id:'{$obj.obj_id}',
								fieldname:'{$content.fieldname}',
								prefix:'{$prefix}',
								suffix:'{$suffix}'
								{literal}
							}]}
					);
				
				{/literal}{/strip}" />
			</div>
		</div>
		<br style="clear:both;" />
	</div>
</div>
